<?php
// +----------------------------------------------------------------------
// | 青航系统 [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2023-永久 https://www.feifeiyu.club/ All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 青航-不吃芒果 <1716892803@qq.com>
// +----------------------------------------------------------------------

namespace app\admin\controller;
use think\exception\Jump;
use think\facade\View;
class System extends  Common{
    
    // 配置提交
    public function index() {
        if (request()->isPost()) {
    	    if(Session('roleid') != 1)
    	    Jump::error('权限不足！');
    		$arr = array();
    		$k = input('post.');
    		D('config')->where(['status'=>1])->update(['value'=>'']);
    		foreach($k as $key => $value) {
    			if(in_array($key, array('site_theme'))) {
    				$value =  safe_replace(trim($value));
    				$arr[$key] = $value;
    			} else {
    				if($key != 'site_code') {
    					$value = htmlspecialchars(trim($value));
    				}
    			}
    			
    			$r = D('config')->where(['name'=>$key])->update(['value'=>$value]);
    		}
    		if($r) {
        		Jump::success('更新成功!');
        	}
        	}
    	
    	return view('system/index',['them_pc'=>get_theme_list('index'),'them_member'=>get_theme_list('member')]);
    }
    
    
}